serializeConfig

fun <T : Any> serializeConfig(config: T, errorBuilder: MutableList<String>, flags: Byte = 1): String

Serializes a config class to a string.

Extension of serializeToToml that takes the additional step of encoding to string. Use to write to a file or packet.

Return

Returns a TomlElement of the serialized config

Author

fzzyhmstrs

Since

0.2.0

Parameters

T

Type of the config to serialize. Can be any Non-Null type.

config

the config instance to serialize from

errorBuilder

the error list. error messages are appended to this for display after the serialization call

flags

default IGNORE_NON_SYNC. With the default, elements with the NonSync annotation will be skipped. See the flag options below to serialize the entire config (ex: saving to file), fully syncing (ex: initial sync server -> client), etc.

  • CHECK_NON_SYNC: Byte = 0

  • IGNORE_NON_SYNC: Byte = 1

  • CHECK_RESTART: Byte = 2

  • IGNORE_NON_SYNC_AND_CHECK_RESTART: Byte = 3

  • IGNORE_VISIBILITY: Byte = 4